// 批量按键消抖模块
module key_filter (
    input                   clk,
    input                   rst_n,

    input       [7:1]       pb,
    output      [7:1]       pb_flag,

    output                  us_p,
    output                  ms_p,
    output                  s_p
);
    
freq_div freq_div_inst
(
    .clk_50m                (clk),
    .rst_n                  (rst_n),
    .us_p                   (us_p),
    .ms_p                   (ms_p),
    .s_p                    (s_p)
);

// Generate block
genvar i;
generate
    for(i=1; i<8; i=i+1) begin: pb_filter_block
        pb_filter pb_filter_inst (
            .clk            (clk),
            .rst_n          (rst_n),
            .ms_p           (ms_p),
            .key_in         (pb[i]),
            .is_low         (1'b1),
            .key_out        (pb_flag[i])
        );
	end
endgenerate

endmodule